home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Source / PacMan / GameBrain.h < prev    next >
Encoding:
Text File  |  1992-07-25  |  3.5 KB  |  83 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. // This handles a lot of the logic of the game; it has application delegate
  5. // methods to deal with start up and shut down of the application.  It also
  6. // has some window delegate methods that work in conjunction with the game
  7. // window (window with the playing field).  It starts and stops the game,
  8. // odes pausing, makes sure initialization is done properly, moves from
  9. // level to level, and tracks the score along with various bonuses.
  10.  
  11. #import <objc/Object.h>     // superclass
  12. #import <objc/typedstream.h>    // highscore tables
  13. #import <appkit/Matrix.h>     // matrix controls' methods
  14. #import <appkit/Control.h>     // various controls' methods
  15. #import <appkit/Panel.h>    // Alert Panels
  16. #import <appkit/defaults.h>    // preferences (defaults)
  17. #import <appkit/Application.h>    // application stuff
  18. #import <appkit/TextField.h>    // high score text fields
  19. #import "GameView.h"        // the brain's partner in crime
  20. #import "HighScoreTable.h"    // to handle high scores
  21.  
  22. @interface GameBrain:Object
  23. {
  24.     id    alert;                // tells user to wait during load
  25.     id    levelText;            // textField on status window
  26.     id    gameScreen;            // gameView instance    
  27.     id    topScoreText;        // high score textField on status window
  28.     id    scoreText;            // score textField on status window
  29.     id  pauseMenuCell;        // menuCell that pauses/unpauses game
  30.     id  gameWindow;            // window holding gameView
  31.     id    highScoreTable;        // object to handle High Scores
  32.     id  preferencesBrain;    // object to handle Preferences Panel
  33.     id  infoController;        // object to put out info/help panels
  34.     id  soundPlayer;        // the object handling the sounds
  35.     id  loadingPanel;        // to tell the user we're awake
  36.     id  fruitBasket;        // displays fruit for each level
  37.     id  pacsLeft;            // displays PacMen left
  38.         
  39.     BOOL paused;            // game is paused flag
  40.     BOOL ranOnce;            // did the player at least play one game?
  41.     
  42.     // instance variables to hold preferences and game status:
  43.     int score, level, viruses, speed, ghostCount, pointsToNextBonus, lastBonus;
  44. }
  45.  
  46. - init;                    // designated initializer
  47. - (int)level;            // returns current play level
  48. - (int)speed;            // returns speed
  49.  
  50. - zeroScore;
  51. - addToScore:(int)increment;    // add an int to the score
  52. - gameOver;            // end the game & wrap it up, disp. "game over" 
  53. - (int)pause;        // pause the game - internal method
  54. - (int)paused;        // are we paused?
  55. - unpause;            // unpause the game - internal method
  56. - showHigh;            // update the "high score field    
  57.     // Interface Builder (IB) methods:
  58. - pauseGame:sender;        // to be sent by menu item
  59. - startNewGame:sender;        // called by New Game menu item and on startup
  60. - unpauseGame:sender;        // same as pauseGame:
  61. - gameOver:sender;        // sent by gameScreen when game is over.
  62. - nextLevel:sender;        // advance game to next level - internal
  63.  
  64. - (int)ateGhost;    // eating ghosts is tracked by these methods since
  65. - resetGhostScore;    // the score depends on how many ghosts are eaten
  66.  
  67. - appWillInit:sender;        // puts up loading alert.
  68. - appDidInit:sender;        // starts up the game on launch
  69. - appDidBecomeActive:sender;    // reactivates the game
  70. - appDidHide:sender;        // deactivates the game
  71. - appDidResignActive:sender;    // reactivates the game
  72. - appDidUnhide:sender;        // deactivates the game
  73. - appWillTerminate:sender;    // saves high scores and preferences
  74. - quit:sender;            // to catch the "quit" menu item
  75.  
  76. - windowDidResginMain:sender;    // do pause if window loses main status
  77. - windowDidResignKey:sender;    // do pause if window loses key status
  78. - windowDidBecomeKey:sender;    // do unpause if window gains key status 
  79. - windowDidMove:sender;        // move fruit basket and status with game window 
  80.  
  81.  
  82. @end
  83.